package wechat

//UserInfoGzh 公众号用户信息
type UserInfoGzh struct {
	Openid     string        `json:"openid"`
	Nickname   string        `json:"nickname"`
	Sex        int           `json:"sex"`
	Province   string        `json:"province"`
	City       string        `json:"city"`
	Country    string        `json:"country"`
	Headimgurl string        `json:"headimgurl"`
	Privilege  []interface{} `json:"privilege"`
	Unionid    string        `json:"unionid"`
	Errcode    int           `json:"errcode"`
	Errmsg     string        `json:"errmsg"`
}

//GzhLogin 获取公众号用户信息
//func (w *Wx) LoginPublic(code string) (userinfo *UserInfoGzh, err error) {
//	tokenURL := fmt.Sprintf(publictokenurl, w.config.Appid, w.config.Appsecret, code)
//	resp, err := http.Get(tokenURL)
//	if err != nil {
//		return
//	}

//req1 := httplib.Get(tokenURL)
//m1 := new(Token)
//req1.ToJSON(&m1)
//if m1.Errcode != 0 {
//	beego.Debug(m1.Errcode)
//	err = errors.New(m1.Errmsg)
//	return
//}
//accessTokenURL := "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=" + Appid + "&grant_type=refresh_token&refresh_token=" + m1.RefreshToken
//req2 := httplib.Get(accessTokenURL)
//m2 := new(Token)
//req2.ToJSON(&m2)
//if m2.Errcode != 0 {
//	beego.Debug(m2.Errcode)
//	err = errors.New(m2.Errmsg)
//	return
//}
//userInfoURL := "https://api.weixin.qq.com/sns/userinfo?access_token=" + m2.AccessToken + "&openid=" + m2.Openid + "&lang=zh_CN"
//req3 := httplib.Get(userInfoURL)
//req3.ToJSON(&userinfo)
//	return
//}
